﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FisheryPlatform.Search.Core.Analysis
{
    /// <summary>
    /// Lexicon: The abstract lexicon class.
    /// </summary>
    /// <author>gwd, 2006-6-10</author>
    public abstract class Lexicon
    {
        public const string LEXICON_PREFIX = "LEXICON";     // the prefix of a lexicon file.
        public const string LEXICON_EXT = "LEX";      // the extension of a lexicon data file.
        public const string LEXICON_INDEX_EXT = "IDX";      // the extension of a lexicon index file.

        private Dictionary _dictionary;

        public Lexicon(Dictionary dic)
        {
            _dictionary = dic;
        }

        /// <summary>
        /// Load lexicon index from index files.
        /// </summary>
        internal abstract void LoadLexiconIndex();

        /// <summary>
        /// Load lexicon data from data files.
        /// </summary>
        internal abstract void LoadLexicon();

        /// <summary>
        /// Fetch lexicon items started with "key".
        /// </summary>
        /// <param name="key">the key for lexicon items</param>
        /// <returns></returns>
        internal abstract object GetEntry(string key);

        /// <summary>
        /// Get a chinese word's frequence.
        /// </summary>
        /// <param name="word">a chinese word</param>
        /// <returns></returns>
        internal abstract long GetWordFreq(string word);
    }
}
